﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Services;
using DDSC.OracleADO;
using com.ddsc.common;
using System.Collections;

namespace smasb2b.VND
{
    /// <summary>
    ///VNDW0010 的摘要描述
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允許使用 ASP.NET AJAX 從指令碼呼叫此 Web 服務，請取消註解下列一行。
    [System.Web.Script.Services.ScriptService]
    public class VNDW0010 : System.Web.Services.WebService
    {

        [WebMethod]
        public bool Query_VENDOR_NO(string VENDOR_NO)
        {
            DataSet dsReturn = default(DataSet);
            //DataSet ds = p_ddscDt.getDataSet();

            //string VENDOR_NO = "";
            try
            {

                // 查詢資料總筆數之 sql command
                StringBuilder sb = new StringBuilder();
                //VENDOR_NO = ds.Tables[0].Rows[1]["VENDOR_NO"].ToString();
                sb.Append("Select * From VND_B2B_VENDOR ");
                //sb.Append("Where VENDOR_NO = \'" + VENDOR_NO + "\'");
                sb.Append("Where VENDOR_NO = :VENDORNO");
                // DataTable Name
                string dtName = "VND_B2B_VENDOR";

                // Sql command
                string sqlCommands = sb.ToString();

                // create database access object
                dbAccess dba = new dbAccess();
                ArrayList m_arrParam = new ArrayList();
                //Ken : 2.設定動態參數物件
                m_arrParam.Add(dba.GetOracleParam(":VENDORNO", VENDOR_NO));
                //Ken : 3.修改執行方法Overload
                dsReturn = dba.runExecuteQuery(dtName, sqlCommands, m_arrParam);
            }
            catch (Exception ex)
            {
                // create return object (DataSet)
                dsReturn = new DataSet("VND_B2B_VENDOR");
                //dsReturn.Tables.Add(createErrorTable(ex.Message));
            }

            return dsReturn.Tables[1].Rows.Count == 0 ? false : true;
        }
    }
}
